#include "widget.h"
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDebug>

#define DBUS_NAME       "org.ukui.Sidebar"
#define DBUS_PATH       "/org/ukui/Sidebar"
#define DBUS_INTERFACE  "org.freedesktop.DBus.profile"
#define METHOD_NAME     "profileOperation"

#define DESKTOP         "ukui-feedback.desktop"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    //创建一个QDBusMessage的method调用
    QDBusMessage msg = QDBusMessage::createMethodCall(DBUS_NAME,DBUS_PATH,DBUS_INTERFACE,METHOD_NAME);
    msg << "ukui-feedback.desktop";  //填充要发送的数据:数据为应用的desktop文件名
    //调用method
    QDBusMessage response = QDBusConnection::sessionBus().call(msg);
    if (response.type() == QDBusMessage::ReplyMessage)//判断method的返回值
    {
        qDebug() << "------" << response.arguments().takeFirst().toString();
    }
    else{
        qDebug() << "======" << response.type();
    }
}

Widget::~Widget()
{
}

